package com.zju.cst.cloudApp.mockSys;

import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.DefaultChannelPipeline;

import com.zju.cst.cloudApp.server.decoder.MessageDecoder;
import com.zju.cst.cloudApp.server.encode.MessageEncoder;

public class MessageClientPipelineFactory implements ChannelPipelineFactory {

	private String message;

	@Override
	public ChannelPipeline getPipeline() throws Exception {
	
		ChannelPipeline pipeline = new DefaultChannelPipeline();

		pipeline.addLast("decoder", new MessageDecoder());
		pipeline.addLast("encoder", new MessageEncoder());
		pipeline.addLast("handler", new MessageClientHandler(message));

		return pipeline;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
